package com.burmagateway.controller;


import java.util.Date;
import java.util.Map;

import org.hibernate.id.GUIDGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;



import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.burmagateway.model.*;
import com.burmagateway.service.*;

@RequestMapping("/account/**")
@Controller
public class registerController {

	@Autowired
	private UserAccountService userAccountService;
	
	@RequestMapping(value="/CreateUser",method=RequestMethod.GET)
	public String CreateUser(Map<String,Object> map){	
		map.put("CreateUser", new UserAccount());	
		return "account/CreateUser";
	}
	
	@RequestMapping(value="/AddNewUser",method=RequestMethod.POST)
	public String AddUser(@ModelAttribute("CreateUser") UserAccount user,BindingResult result){
		userAccountService.addUserAccount(user);
		System.out.println(user.getCustomerId());
		return "account/CreateUser";
	}

}
